library(foreign)
library(dplyr)
library(arm)
library(lfe)
library(readr)
library(stargazer)
set.seed(6)
## these functions alter the standard lag/lead code to eliminate incorrect lagging/leading when there are missing years
lag.new <- function(x, n = 1L, along_with){
index <- match(along_with - n, along_with, incomparable = NA)
out <- x[index]
attributes(out) <- attributes(x)
out
}
lead.new <- function(x, n = 1L, along_with){
index <- match(along_with + n, along_with, incomparable = NA)
out <- x[index]
attributes(out) <- attributes(x)
out
}
setwd("../")
# data_analysis <- read.dta(file="econ_counties_cities_analysis.dta")
load(file="econ_counties_cities_analysis.Rdata")
federal_localoffice <- felm(partisanship_federal_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta* house_party +wages_perworker_real_delta* senate_party |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
state_localoffice <- felm(partisanship_state_delta ~ wages_perworker_real_delta* pres_dem_control +wages_perworker_real_delta* gov_dem_control|fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
state_localofficeb <- felm(partisanship_state_delta2 ~ wages_perworker_real_delta* pres_dem_control +wages_perworker_real_delta* gov_dem_control|fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
president <- felm(pres_demshare_delta ~ wages_perworker_real_delta* pres_dem_control +wages_perworker_real_delta* senate_party+wages_perworker_real_delta* house_party|fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
senate_localoffice <- felm(sen_demshare_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta* house_party +wages_perworker_real_delta* senate_party |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
house_localoffice <- felm(house_demshare_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta* house_party+wages_perworker_real_delta* senate_party |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
gov_localoffice <- felm(gov_demshare_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta* gov_dem_control |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
sldl_localoffice <- felm(sldl_demshare_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta* gov_dem_control |fips+state_year|0|fips,  data=data_analysis[ data_analysis$population_2010 > 20000,])
cities_localoffice <- felm(mayor_demshare_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta*mayor_dem_control+wages_perworker_real_delta* gov_dem_control |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
counties_localoffice <- felm(countyleg_avg_demshare_delta_alldistricts ~ wages_perworker_real_delta * pres_dem_control+wages_perworker_real_delta* county_dem_control|fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
counties_localoffice3 <- felm(countyleg_avg_demshare_delta_alldistricts ~ wages_perworker_real_delta * pres_dem_control+wages_perworker_real_delta* county_dem_control+wages_perworker_real_delta* gov_dem_control|fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
stateoffice_localoffice <- felm(stateoffice_demshare_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta* gov_dem_control  |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
stargazer( president,senate_localoffice,  house_localoffice,federal_localoffice)
stargazer(president, senate_localoffice, house_localoffice, federal_localoffice,
dep.var.caption = "\\emph{Dependent Variable - $\\Delta$ in Vote Share for:}",
dep.var.labels = c("President","Senate","House","Federal Average"),
omit = c("^pres_dem_control$","^senate_party$","^house_party$"),
order = c("wages_perworker_real_delta:pres_dem_control",
"wages_perworker_real_delta:senate_party",
"wages_perworker_real_delta:house_party",
"wages_perworker_real_delta"),
covariate.labels = c("Change in logged wages $\\times$ Democratic pres.",
"Change in logged wages $\\times$ Democratic Senate",
"Change in logged wages $\\times$ Democratic House",
"Change in logged wages"
),
float=F,
add.lines = list(c("FE for State-Year","X","X","X","X"),
c("FE for County","X","X","X","X")),
omit.stat = "ser",notes.append = F,
notes = "Standard errors clustered by county. $^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01",notes.align = "l",
out = "Tables/tabF5.tex")
stargazer(gov_localoffice,stateoffice_localoffice, sldl_localoffice,counties_localoffice,state_localofficeb
)
stargazer(gov_localoffice,stateoffice_localoffice, sldl_localoffice,counties_localoffice,state_localofficeb,
dep.var.caption = "\\emph{Dependent Variable - $\\Delta$ in Vote Share for:}",
dep.var.labels = c("Governor","Downballot State Offices","State House","County Legislature","State/Local Average"),
omit = c("^pres_dem_control$","^gov_dem_control$","^county_dem_control$"),
order = c("wages_perworker_real_delta:pres_dem_control",
"wages_perworker_real_delta:gov_dem_control",
"wages_perworker_real_delta:county_dem_control",
"wages_perworker_real_delta"),
covariate.labels = c("Change in logged wages $\\times$ Democratic Pres.",
"Change in logged wages $\\times$ Democratic Gov.",
"Change in logged wages $\\times$ Democratic Leg.",
"Change in logged wages"
),
float=F,
add.lines = list(c("FE for State-Year","X","X","X","X"),
c("FE for County","X","X","X","X")),
omit.stat = "ser",notes.append = F,
notes = "Standard errors clustered by county. $^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01",notes.align = "l",
out = "Tables/tabF6.tex")
# local
stargazer(cities_localoffice, counties_localoffice,local_localoffice)
local_localoffice
# local
stargazer(cities_localoffice, counties_localoffice)
cities_localoffice
##---------------------------------------------------------------##
#### Appendix C: Effect of Economy Over Entire Electoral Cycle ####
##---------------------------------------------------------------##
### Lagged economic growth, June 2019 addition
federal_electoral_cycle <- felm(partisanship_federal_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta_lag1* pres_dem_control +wages_perworker_real_delta_lag2* pres_dem_control +wages_perworker_real_delta_lag3* pres_dem_control |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
state_electoral_cycle <- felm(partisanship_state_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta_lag1* pres_dem_control +wages_perworker_real_delta_lag2* pres_dem_control +wages_perworker_real_delta_lag3* pres_dem_control |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
stargazer(federal_electoral_cycle, state_electoral_cycle,
dep.var.caption = "\\emph{Dependent Variable - $\\Delta$ in Democratic Vote Share for:}",
dep.var.labels = c("Federal Average","State Average")
,type="text")
stargazer(federal_electoral_cycle, state_electoral_cycle,
dep.var.caption = "\\emph{Dependent Variable - $\\Delta$ in Democratic Vote Share for:}",
dep.var.labels = c("Federal Average","State Average"),
omit = c("^pres_dem_control$"
),
order = c("wages_perworker_real_delta:pres_dem_control",
"wages_perworker_real_delta_lag1:pres_dem_control",
"wages_perworker_real_delta_lag2:pres_dem_control",
"wages_perworker_real_delta_lag3:pres_dem_control",
"wages_perworker_real_delta",
"wages_perworker_real_delta_lag1",
"wages_perworker_real_delta_lag2",
"wages_perworker_real_delta_lag3",
),
covariate.labels = c("Change in logged wages $\\times$ Democratic president",
"Change in logged wages (t-1) $\\times$ Democratic president",
"Change in logged wages (t-2) $\\times$ Democratic president",
"Change in logged wages (t-3) $\\times$ Democratic president",
"Change in logged wages",
"Change in logged wages (t-1)",
"Change in logged wages (t-2)",
"Change in logged wages (t-3)"
),
add.lines = list(c("FE for State-Year","X","X"),
c("FE for County","X","X")),
float=F,
omit.stat = "ser",notes.append = F,
notes = "Standard errors clustered by county. $^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01",notes.align = "l",
out = "Tables/tabC1.tex")
stargazer(federal_electoral_cycle, state_electoral_cycle,
dep.var.caption = "\\emph{Dependent Variable - $\\Delta$ in Democratic Vote Share for:}",
dep.var.labels = c("Federal Average","State Average"),
omit = c("^pres_dem_control$"
),
order = c("wages_perworker_real_delta:pres_dem_control",
"wages_perworker_real_delta_lag1:pres_dem_control",
"wages_perworker_real_delta_lag2:pres_dem_control",
"wages_perworker_real_delta_lag3:pres_dem_control",
"wages_perworker_real_delta",
"wages_perworker_real_delta_lag1",
"wages_perworker_real_delta_lag2",
"wages_perworker_real_delta_lag3"
),
covariate.labels = c("Change in logged wages $\\times$ Democratic president",
"Change in logged wages (t-1) $\\times$ Democratic president",
"Change in logged wages (t-2) $\\times$ Democratic president",
"Change in logged wages (t-3) $\\times$ Democratic president",
"Change in logged wages",
"Change in logged wages (t-1)",
"Change in logged wages (t-2)",
"Change in logged wages (t-3)"
),
add.lines = list(c("FE for State-Year","X","X"),
c("FE for County","X","X")),
float=F,
omit.stat = "ser",notes.append = F,
notes = "Standard errors clustered by county. $^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01",notes.align = "l",
out = "Tables/tabC1.tex")
## Appendix D:Additional Specifications
federal6_LDV <- felm(partisanship_federal ~ wages_perworker_real_delta* pres_dem_control +partisanship_federal_lagged|fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
federal6_LDV_nofe <- felm(partisanship_federal ~ wages_perworker_real_delta* pres_dem_control +partisanship_federal_lagged|state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
federal6_LDV <- felm(partisanship_federal ~ wages_perworker_real_delta* pres_dem_control +partisanship_federal_lagged|fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
federal6_LDV_nofe <- felm(partisanship_federal ~ wages_perworker_real_delta* pres_dem_control +partisanship_federal_lagged|state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
## state
state6_LDV <- felm(partisanship_state ~ wages_perworker_real_delta* pres_dem_control +partisanship_state_lag|fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
state6_LDV_nofe <- felm(partisanship_state ~ wages_perworker_real_delta* pres_dem_control +partisanship_state_lag|state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
stargazer(federal6_LDV,federal6_LDV_nofe,state6_LDV,state6_LDV_nofe,
dep.var.caption = "\\emph{Dependent Variable - $\\Delta$ in Vote Share for:}"
,type=
"text")
data_analysis$lagged_dv_common <- data_analysis$partisanship_federal_lagged
federal6_LDV <- felm(partisanship_federal ~ wages_perworker_real_delta* pres_dem_control +lagged_dv_common|fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
federal6_LDV_nofe <- felm(partisanship_federal ~ wages_perworker_real_delta* pres_dem_control +lagged_dv_common|state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
## state
data_analysis$lagged_dv_common <- data_analysis$partisanship_state_lag
state6_LDV <- felm(partisanship_state ~ wages_perworker_real_delta* pres_dem_control +lagged_dv_common|fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
state6_LDV_nofe <- felm(partisanship_state ~ wages_perworker_real_delta* pres_dem_control +lagged_dv_common|state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
stargazer(federal6_LDV,federal6_LDV_nofe,state6_LDV,state6_LDV_nofe,
dep.var.caption = "\\emph{Dependent Variable - $\\Delta$ in Vote Share for:}"
,type="text")
stargazer(federal6_LDV,federal6_LDV_nofe,state6_LDV,state6_LDV_nofe,
dep.var.caption = "\\emph{Dependent Variable - $\\Delta$ in Vote Share for:}",
dep.var.labels = c("Federal Average","State Average"),
omit = "^pres_dem_control",
order = c("wages_perworker_real_delta:pres_dem_control",
"wages_perworker_real_delta",
"lagged_dv_common"),
covariate.labels = c("Change in logged wages $\\times$ Democratic president",
"Change in logged wages",
"Lagged Democratic voteshare"
),
float=F,
add.lines = list(c("FE for State-Year","X","X","X","X"),
c("FE for County","X"," ","X"," ")),
omit.stat = "ser",notes.append=F,
notes = "Standard errors clustered by county. $^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01",notes.align = "l",
out = "Tables/tabD2.tex")
stargazer(federal6_LDV,federal6_LDV_nofe,state6_LDV,state6_LDV_nofe,
dep.var.caption = "\\emph{Dependent Variable - $\\Delta$ in Vote Share for:}",
dep.var.labels = c("Federal Average","State Average"),
omit = "^pres_dem_control",
order = c("wages_perworker_real_delta:pres_dem_control",
"wages_perworker_real_delta",
"lagged_dv_common"),
covariate.labels = c("Change in logged wages $\\times$ Democratic president",
"Change in logged wages",
"Lagged Democratic voteshare"
),
float=F,
add.lines = list(c("FE for State-Year","X","X","X","X"),
c("FE for County","X"," ","X"," ")),
omit.stat = "ser",
notes = "Standard errors clustered by county.",notes.align = "l",
out = "Tables/tabD2.tex")
data_analysis$incumbent <- data_analysis$pres_dem_control
president_incumbency2 <- felm(pres_demshare_delta ~ wages_perworker_real_delta* incumbent |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
data_analysis$incumbent <- data_analysis$house_dem_incumb
house_incumbency2 <- felm(house_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*incumbent|fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
data_analysis$incumbent <- data_analysis$senate_dem_incumb
senate_incumbency2 <- felm(sen_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*incumbent|fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
data_analysis$incumbent <- data_analysis$gov_dem_control
gov_incumbency2 <- felm(gov_demshare_delta ~ wages_perworker_real_delta* pres_dem_control* incumbent |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
data_analysis$incumbent <- data_analysis$sldl_dem_incumb
sldl_incumbency2 <- felm(sldl_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*incumbent |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
stargazer(president_incumbency2,senate_incumbency2,house_incumbency2,gov_incumbency2,sldl_incumbency2,
dep.var.caption = "\\emph{Dependent Variable - Change in Vote Share for:}",
dep.var.labels = c("President","Senate","House","Governor","State House"),
omit = "^pres_dem_control$",
type="text")
stargazer(president_incumbency2,senate_incumbency2,house_incumbency2,gov_incumbency2,sldl_incumbency2,
dep.var.caption = "\\emph{Dependent Variable - Change in Vote Share for:}",
dep.var.labels = c("President","Senate","House","Governor","State House"),
omit = "^pres_dem_control$",
order = c("wages_perworker_real_delta:pres_dem_control:incumbent",
"wages_perworker_real_delta:pres_dem_control",
"wages_perworker_real_delta:incumbent",
"wages_perworker_real_delta","incumbent",
"pres_dem_control:incumbent"),
covariate.labels = c("Change in logged wages $\\times$ Democratic pres. $\\times$ Democratic incumbent",
"Change in logged wages $\\times$ Democratic president",
"Change in logged wages $\\times$ Democratic incumbent",
"Change in logged wages",
"Democratic incumbent",
"Democratic president $\\times$ Democratic incumbent"
),
float=F,
omit.stat = "ser",notes.append = F,
notes = "Standard errors clustered by county. $^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01",notes.align = "l",
out = "Tables/tabE4.tex")
federal_localoffice <- felm(partisanship_federal_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta* house_party +wages_perworker_real_delta* senate_party |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
state_localoffice <- felm(partisanship_state_delta ~ wages_perworker_real_delta* pres_dem_control +wages_perworker_real_delta* gov_dem_control|fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
state_localofficeb <- felm(partisanship_state_delta2 ~ wages_perworker_real_delta* pres_dem_control +wages_perworker_real_delta* gov_dem_control|fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
president <- felm(pres_demshare_delta ~ wages_perworker_real_delta* pres_dem_control +wages_perworker_real_delta* senate_party+wages_perworker_real_delta* house_party|fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
senate_localoffice <- felm(sen_demshare_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta* house_party +wages_perworker_real_delta* senate_party |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
house_localoffice <- felm(house_demshare_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta* house_party+wages_perworker_real_delta* senate_party |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
gov_localoffice <- felm(gov_demshare_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta* gov_dem_control |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
sldl_localoffice <- felm(sldl_demshare_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta* gov_dem_control |fips+state_year|0|fips,  data=data_analysis[ data_analysis$population_2010 > 20000,])
cities_localoffice <- felm(mayor_demshare_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta*mayor_dem_control+wages_perworker_real_delta* gov_dem_control |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
counties_localoffice <- felm(countyleg_avg_demshare_delta_alldistricts ~ wages_perworker_real_delta * pres_dem_control+wages_perworker_real_delta* county_dem_control|fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
counties_localoffice3 <- felm(countyleg_avg_demshare_delta_alldistricts ~ wages_perworker_real_delta * pres_dem_control+wages_perworker_real_delta* county_dem_control+wages_perworker_real_delta* gov_dem_control|fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
stateoffice_localoffice <- felm(stateoffice_demshare_delta ~ wages_perworker_real_delta* pres_dem_control+wages_perworker_real_delta* gov_dem_control  |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
stargazer(gov_localoffice,stateoffice_localoffice, sldl_localoffice,counties_localoffice,state_localofficeb,
dep.var.caption = "\\emph{Dependent Variable - $\\Delta$ in Vote Share for:}",
dep.var.labels = c("Governor","Downballot State Offices","State House","County Legislature","State/Local Average"),
omit = c("^pres_dem_control$","^gov_dem_control$","^county_dem_control$"),
order = c("wages_perworker_real_delta:pres_dem_control",
"wages_perworker_real_delta:gov_dem_control",
"wages_perworker_real_delta:county_dem_control",
"wages_perworker_real_delta"),
covariate.labels = c("Change in logged wages $\\times$ Democratic Pres.",
"Change in logged wages $\\times$ Democratic Gov.",
"Change in logged wages $\\times$ Democratic Leg.",
"Change in logged wages"
),
float=F,
add.lines = list(c("FE for State-Year","X","X","X","X","X"),
c("FE for County","X","X","X","X","X")),
omit.stat = "ser",notes.append = F,
notes = "Standard errors clustered by county. $^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01",notes.align = "l",
out = "Tables/tabF6.tex")
pres_pre1990 <- felm(pres_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year<1990))
sen_pre1990 <- felm(sen_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year<1990))
house_pre1990 <- felm(house_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year<1990))
federal_pre1990 <- felm(partisanship_federal_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year<1990))
gov_pre1990 <- felm(gov_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year<1990))
stateexec_pre1990 <- felm(stateoffice_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year<1990))
sldl_pre1990 <- felm(sldl_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year<1990))
sldu_pre1990 <- felm(sldu_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year<1990))
state_pre1990 <- felm(partisanship_state_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year<1990))
county_pre1990 <- felm(countyleg_avg_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year<1990))
mayor_pre1990 <- felm(mayor_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year<1990))
## Post:
pres_post1990 <- felm(pres_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year>=1990))
sen_post1990 <- felm(sen_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year>=1990))
house_post1990 <- felm(house_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year>=1990))
federal_post1990 <- felm(partisanship_federal_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year>=1990))
gov_post1990 <- felm(gov_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year>=1990))
stateexec_post1990 <- felm(stateoffice_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year>=1990))
sldl_post1990 <- felm(sldl_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year>=1990))
sldu_post1990 <- felm(sldu_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year>=1990))
state_post1990 <- felm(partisanship_state_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year>=1990))
county_post1990 <- felm(countyleg_avg_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year>=1990))
mayor_post1990 <- felm(mayor_demshare_delta ~ wages_perworker_real_delta*pres_dem_control
| fips + state_year |0| fips,
data=filter(data_analysis, population_2010 > 20000 & year>=1990))
## Table H-8 ##
stargazer(federal_pre1990, state_pre1990,federal_post1990, state_post1990,
dep.var.caption = "\\emph{Dependent Variable - $\\Delta$ in Democratic Vote Share for:}",
dep.var.labels = c("Federal (pre-1990)","State (pre-1990)","Federal (post-1990)","State (post-1990)"),
omit = c("^pres_dem_control$"
),
order = c("wages_perworker_real_delta:pres_dem_control",
"wages_perworker_real_delta"
),
covariate.labels = c("Change in logged wages $\\times$ Democratic pres.",
"Change in logged wages"
),
add.lines = list(c("FE for State-Year","X","X","X","X"),
c("FE for County","X","X","X","X")),
float=F,
omit.stat = "ser",notes.append = F,
notes = "Standard errors clustered by county. $^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01",notes.align = "l",
out = "Tables/tabH8.tex")
data_analysis$state_year_newspaper <- paste(data_analysis$state_year,data_analysis$county_newspaper, sep="-")
data_analysis$state_year_newspaper2 <- paste(data_analysis$state_year,data_analysis$dailypaper, sep="-")
federal_media <- felm(partisanship_federal_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper|fips+state_year_newspaper|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
state_media <- felm(partisanship_state_delta2 ~ wages_perworker_real_delta* pres_dem_control*county_newspaper|fips+state_year_newspaper|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
federal_media2 <- felm(partisanship_federal_delta ~ wages_perworker_real_delta* pres_dem_control*dailypaper|fips+state_year_newspaper2|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
state_media2 <- felm(partisanship_state_delta2 ~ wages_perworker_real_delta* pres_dem_control*dailypaper|fips+state_year_newspaper2|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
president_media <- felm(pres_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper|fips+state_year_newspaper|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
senate_president_media <- felm(sen_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
house_president_media <- felm(house_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
president_media <- felm(pres_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper|fips+state_year_newspaper|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
data_analysis$incumbent <- data_analysis$senate_dem_incumb
senate_president_media <- felm(sen_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper+wages_perworker_real_delta* incumbent*county_newspaper |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
data_analysis$incumbent <- data_analysis$house_dem_incumb
house_president_media <- felm(house_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper+wages_perworker_real_delta* incumbent*county_newspaper |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
data_analysis$incumbent <- data_analysis$gov_dem_control
gov_president_media <- felm(gov_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper+wages_perworker_real_delta* incumbent*county_newspaper |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
data_analysis$incumbent <- data_analysis$sldl_dem_incumb
sldl_president_media <- felm(sldl_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper+wages_perworker_real_delta* incumbent*county_newspaper |fips+state_year|0|fips,  data=data_analysis[  data_analysis$population_2010 > 20000,])
cities_president_media <- felm(mayor_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper+wages_perworker_real_delta*mayor_dem_control*county_newspaper+wages_perworker_real_delta* gov_dem_control*county_newspaper |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
counties_president_media <- felm(countyleg_avg_demshare_delta ~ wages_perworker_real_delta * pres_dem_control*county_newspaper+wages_perworker_real_delta* county_dem_control*county_newspaper+wages_perworker_real_delta* gov_dem_control*county_newspaper|fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
data_analysis$state_year_newspaper <- paste(data_analysis$state_year,data_analysis$county_newspaper, sep="-")
data_analysis$state_year_newspaper2 <- paste(data_analysis$state_year,data_analysis$dailypaper, sep="-")
federal_media <- felm(partisanship_federal_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper|fips+state_year_newspaper|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
state_media <- felm(partisanship_state_delta2 ~ wages_perworker_real_delta* pres_dem_control*county_newspaper|fips+state_year_newspaper|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
federal_media2 <- felm(partisanship_federal_delta ~ wages_perworker_real_delta* pres_dem_control*dailypaper|fips+state_year_newspaper2|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
state_media2 <- felm(partisanship_state_delta2 ~ wages_perworker_real_delta* pres_dem_control*dailypaper|fips+state_year_newspaper2|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
president_media <- felm(pres_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper|fips+state_year_newspaper|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
senate_president_media <- felm(sen_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
house_president_media <- felm(house_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
president_media <- felm(pres_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper|fips+state_year_newspaper|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
data_analysis$incumbent <- data_analysis$senate_dem_incumb
senate_president_media <- felm(sen_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper+wages_perworker_real_delta* incumbent*county_newspaper |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
data_analysis$incumbent <- data_analysis$house_dem_incumb
house_president_media <- felm(house_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper+wages_perworker_real_delta* incumbent*county_newspaper |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
data_analysis$incumbent <- data_analysis$gov_dem_control
gov_president_media <- felm(gov_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper+wages_perworker_real_delta* incumbent*county_newspaper |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
data_analysis$incumbent <- data_analysis$sldl_dem_incumb
sldl_president_media <- felm(sldl_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper+wages_perworker_real_delta* incumbent*county_newspaper |fips+state_year|0|fips,  data=data_analysis[  data_analysis$population_2010 > 20000,])
cities_president_media <- felm(mayor_demshare_delta ~ wages_perworker_real_delta* pres_dem_control*county_newspaper+wages_perworker_real_delta*mayor_dem_control*county_newspaper+wages_perworker_real_delta* gov_dem_control*county_newspaper |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
counties_president_media <- felm(countyleg_avg_demshare_delta ~ wages_perworker_real_delta * pres_dem_control*county_newspaper+wages_perworker_real_delta* county_dem_control*county_newspaper+wages_perworker_real_delta* gov_dem_control*county_newspaper|fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
stargazer(president_media,senate_president_media,house_president_media,gov_president_media,sldl_president_media
,type="text")
stargazer(president_media,senate_president_media,house_president_media,gov_president_media,sldl_president_media,
dep.var.caption = "\\emph{Dependent Variable - $\\Delta$ in Democratic Vote Share for:}",
dep.var.labels = c("President","Senate","House","Governor","State House"),
omit = c("^pres_dem_control$",
"^county_newspaper$"
),
order = c("wages_perworker_real_delta:pres_dem_control:county_newspaper",
"wages_perworker_real_delta:county_newspaper:incumbent",
"wages_perworker_real_delta",
"incumbent",
"wages_perworker_real_delta:pres_dem_control",
"wages_perworker_real_delta:county_newspaper",
"pres_dem_control:county_newspaper",
"wages_perworker_real_delta:incumbent",
"county_newspaper:incumbent"
),
covariate.labels = c("Change in logged wages $\\times$ Democratic pres. $\\times$ newspaper",
"Change in logged wages $\\times$Democratic incumbent $\\times$ newspaper",
"Change in logged wages",
"Democratic incumbent",
"Change in logged wages $\\times$ Democratic pres.",
"Change in logged wages $\\times$ newspaper",
"Democratic pres. $\\times$ newspaper",
"Change in logged wages$\\times$Democratic incumbent",
"Democratic incumbent $\\times$ newspaper"
),
add.lines = list(c("FE for State-Year","X","X","X","X","X"),
c("FE for County","X","X","X","X","X")),
float=F,
omit.stat = "ser",notes.append = F,
notes = "Standard errors clustered by county. $^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01",notes.align = "l",
out = "Tables/tabI9.tex")
federal_basic3 <- felm(partisanship_federal_delta ~ wages_perworker_real_delta* pres_dem_control | fips+state_year |0| fips, data=data_analysis[data_analysis$population_2010 > 20000,])
state_basic3 <- felm(partisanship_state_delta ~ wages_perworker_real_delta* pres_dem_control | fips+state_year |0| fips, data=data_analysis[data_analysis$population_2010 > 20000,])
state_basic3b <- felm(partisanship_state_delta2 ~ wages_perworker_real_delta* pres_dem_control | fips+state_year |0| fips, data=data_analysis[data_analysis$population_2010 > 20000,])
### standardized estimates for introduction
federal_basic3_std <- felm(partisanship_federal_delta ~ scale(wages_perworker_real_delta)* pres_dem_control |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
state_basic3b_std <- felm(partisanship_state_delta2 ~ scale(wages_perworker_real_delta)* pres_dem_control |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
president_basic3 <- felm(pres_demshare_delta ~ wages_perworker_real_delta* pres_dem_control |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
senate_president_basic3 <- felm(sen_demshare_delta ~ wages_perworker_real_delta* pres_dem_control |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
house_president_basic3 <- felm(house_demshare_delta ~ wages_perworker_real_delta* pres_dem_control |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
gov_president_basic3 <- felm(gov_demshare_delta ~ wages_perworker_real_delta* pres_dem_control |fips+state_year|0|fips,  data=data_analysis[data_analysis$population_2010 > 20000,])
sldl_president_basic3 <- felm(sldl_demshare_delta ~ wages_perworker_real_delta* pres_dem_control |fips+state_year|0|fips,  data=data_analysis[   data_analysis$population_2010 > 20000,])
cities_president_basic3 <- felm(mayor_demshare_delta ~ wages_perworker_real_delta* pres_dem_control |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
counties_president_basic3 <- felm(countyleg_avg_demshare_delta_alldistricts ~ wages_perworker_real_delta* pres_dem_control |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
counties_president_basic32 <- felm(countyleg_avg_demshare_delta_district ~ wages_perworker_real_delta* pres_dem_control |fips+state_year|0|fips, data=counties[counties$population_2010 > 20000& counties$n_winners==1,])
stateoffice_basic3 <- felm(stateoffice_demshare_delta ~ wages_perworker_real_delta* pres_dem_control |fips+state_year|0|fips, data=data_analysis[data_analysis$population_2010 > 20000,])
stargazer(gov_president_basic3, stateoffice_basic3, sldl_president_basic3, counties_president_basic3, state_basic3b,
dep.var.caption = "\\emph{Dependent Variable - Change in Vote Share for:}",
dep.var.labels = c("Governor","Downballot State Offices","State House","County Legislature","State Average"),
omit = "^pres_dem_control",
order = c("wages_perworker_real_delta:pres_dem_control","wages_perworker_real_delta"),
covariate.labels = c("Change in logged wages $\\times$ Democratic president",
"Change in logged wages"
),
float=F,
add.lines = list(c("FE for State-Year","X","X","X","X","X"),
c("FE for County","X","X","X","X","X")),
omit.stat = "ser",
notes = "Standard errors clustered by county.",notes.align = "l",
out = "Tables/tab4.tex")
